import {PmBaseInfoProps} from '@/components/others/pm/pmBaseInfo'
import router from '@/router'

/**返回 */
export const goBack = () => {
  router.back()
}

export const toHome = (data?: any) => {
  router.push({
    path: '/',
    query: data || undefined
  })
}

export type MyPerformance = {pmId: string | number}
export const toMyPerformance = (data?: MyPerformance) => {
  router.push({
    path: '/myPerformance/home',
    query: data
  })
}
export const toPhoneMyPerformance = (data?: MyPerformance) => {
  router.push({
    path: '/myPerformance',
    query: data
  })
}

export const toEditEvalutaion = (data: {pmGroupId: number}) => {
  router.push({
    path: '/editEvalutaion',
    query: data || undefined
  })
}

export const toAddEvalutaion = (data: any) => {
  router.push({
    path: '/addEvalutaion',
    query: data || undefined
  })
}

export const toAddTargetToLib = (data?: {targetLibId: number}) => {
  router.push({
    path: '/addTargetToLib',
    query: data || undefined
  })
}

export const toEditTargetToLib = (data: {targetLibId: number}) => {
  router.push({
    path: '/editTargetToLib',
    query: data
  })
}

export type InitiateAssessmentPageQuery = {
  pmGroupId: number
  pmGroupName: string
  pmPeriodCode: string
}
export const toInitiateAssessment = (data?: InitiateAssessmentPageQuery) => {
  router.push({
    path: '/initiateAssessment',
    query: data
  })
}

export type InitiateAssessmentCheckPageQuery = {pmFormId: number; isRefersh?: 0 | 1}
export const toInitiateAssessmentCheck = (data: InitiateAssessmentCheckPageQuery) => {
  router.push({
    path: '/initiateAssessmentCheck',
    query: data
  })
}

export const toInitiateAssessmentInfo = (data: TargetBaseInfoPageQuery) => {
  router.push({
    path: '/initiateAssessmentInfo',
    query: data
  })
}

export type SetTargetPageQuery = {
  pmId: number
  groupId?: number | string
  progressId: number
  userDDId?: string
}
export const toSetTarget = (data: SetTargetPageQuery) => {
  router.push({
    path: '/setTarget',
    query: data
  })
}
export const toPhoneSetTarget = (data: SetTargetPageQuery) => {
  router.push({
    path: '/setTarget',
    query: data
  })
}

export const toSetTargetByLeader = (data: SetTargetPageQuery) => {
  router.push({
    path: '/setTargetByLeader',
    query: data
  })
}

export const toPhoneSetTargetByLeader = (data: SetTargetPageQuery) => {
  router.push({
    path: '/setTargetByLeader',
    query: data
  })
}
export type TargetBaseInfoPageQuery = {
  pmFormId?: number
  groupId?: number
  userDDId?: string
  defaultPmId: number
  title: string
  type: PmBaseInfoProps.Type
}

export const toTargetBaseInfo = (data: TargetBaseInfoPageQuery) => {
  router.push({
    path: '/targetBaseInfo',
    query: data
  })
}

export const toPmDetail = pmId => {
  router.push({
    path: '/targetBaseInfo?defaultPmId=7039&title=员工绩效详情&type=checkInfo',
    query: {
      defaultPmId: pmId,
      title: '员工绩效详情',
      type: 'checkInfo'
    }
  })
}

export type SelfScoreQuery = {
  defaultGroupId?: number
  defaultPmId: number
  // title: string
  // type: PmBaseInfoProps.Type
  ownerDDId?: string
  ownerPmTitle?: string
}
/**前往自评页面 */
export const toScoreBySelf = (data: SelfScoreQuery) => {
  router.push({
    path: '/scoreBySelf',
    query: data
  })
}
/**前往手机端自评页面 */
export const toPhoneScoreBySelf = (data: SelfScoreQuery) => {
  router.push({
    path: '/scoreBySelf',
    query: data
  })
}

export type LeaderScoreQuery = {
  defaultGroupId?: number
  defaultPmId: number
  // title: string
  // type: PmBaseInfoProps.Type
  ownerDDId?: string
  ownerPmTitle?: string
}
/**前往主管评分页面 */
export const toScoreByLeader = (data: LeaderScoreQuery) => {
  router.push({
    path: '/scoreByLeader',
    query: data
  })
}

/**前往系统设置页面 */
export const toManagerSetting = () => {
  router.push({
    path: '/managerSetting'
  })
}

/**前往绩效等级设置页面 */
export const toScoreLevelSetting = () => {
  router.push({
    path: '/scoreLevelSetting'
  })
}

//? 手机端 -----------------------------------

/**前往我的绩效页面 */
export const to_phone_myPerformance = () => {
  router.push({
    path: '/myPerformance'
  })
}

/**前往我的待办页面 */
export const to_phone_taskTodo = () => {
  router.push({
    path: '/taskTodo'
  })
}

/**前往我的已办页面 */
export const to_phone_taskDone = () => {
  router.push({
    path: '/taskDone'
  })
}

/**前往绩效详情页面 */
export const to_phone_pmBaseInfo = (data: {userDDId: string; defaultPmId: number}) => {
  router.push({
    path: '/pmBaseInfo',
    query: data
  })
}
